lib/remote: Add a getter for OstreeRemote.name
authorPhilip Withnall <withnall@endlessm.com>
Thu, 18 May 2017 07:11:32 +0000 (08:11 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 19 May 2017 15:01:59 +0000 (15:01 +0000)
Now that we’ve got a public, sealed OstreeRemote structure, we can start
carefully exposing members of it as API.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #875
Approved by: cgwalters

apidoc/ostree-experimental-sections.txt
src/libostree/libostree-experimental.sym
src/libostree/ostree-remote.c
src/libostree/ostree-remote.h

index 790feb33fb604151452151053c4b804e9ab33db1..998a4f9c47ad0f46e32c0fcb5e2e47c6fbe28d3e 100644 (file)
@@ -3,4 +3,5 @@
 OstreeRemote
 ostree_remote_ref
 ostree_remote_unref
+ostree_remote_get_name
 </SECTION>
index e2ab4ea8bb88f70e1defe12f527605dbb75018fe..1d4feedaaf234fcde1478f5d59f45b9f9896aea7 100644 (file)
@@ -29,3 +29,8 @@ global:
   ostree_remote_ref;
   ostree_remote_unref;
 } LIBOSTREE_2017.6;
+
+LIBOSTREE_2016.7_EXPERIMENTAL {
+global:
+  ostree_remote_get_name;
+} LIBOSTREE_2017.6_EXPERIMENTAL;
index 86fae8d8ae59c3c19009fb9242a50d03fedff30c..f34fafa45170701ab8d6b26d68a5a8497b2d8d57 100644 (file)
@@ -148,3 +148,23 @@ G_DEFINE_BOXED_TYPE(OstreeRemote, ostree_remote,
                     ostree_remote_ref,
                     ostree_remote_unref);
 #endif
+
+/**
+ * ostree_remote_get_name:
+ * @remote: an #OstreeRemote
+ *
+ * Get the human-readable name of the remote. This is what the user configured,
+ * if the remote was explicitly configured; and will otherwise be a stable,
+ * arbitrary, string.
+ *
+ * Returns: remote’s name
+ * Since: 2017.7
+ */
+const gchar *
+ostree_remote_get_name (OstreeRemote *remote)
+{
+  g_return_val_if_fail (remote != NULL, NULL);
+  g_return_val_if_fail (remote->ref_count > 0, NULL);
+
+  return remote->name;
+}
index 8e96213cdbe468d65967969eb7f5e19d14ca7909..5505bc1d95f0cea5770081b74284f08d1a2be60f 100644 (file)
@@ -60,4 +60,7 @@ void ostree_remote_unref (OstreeRemote *remote);
 #endif /* GI_SCANNER */
 #endif
 
+_OSTREE_PUBLIC
+const gchar *ostree_remote_get_name (OstreeRemote *remote);
+
 G_END_DECLS